<template>
	<view class="page">
			<view class="header">
				<video src="" controls></video>
			</view>
			<view class="img-text1">
				<view class="leftimg">
					<!-- <navigator :url="'../../cover/cover?cover='"+movieinfo.cover>
						<image :src="movieinfo.cover" class="leftimg" ></image>
					</navigator> -->
					<image :src="movieinfo.cover" class="leftimg" @click="getbigger()"></image>
				</view>
				<view class="righttext">
					<view class="title">
						{{movieinfo.name}}
					</view>
					<view class="startime baseinfo">
						{{movieinfo.basicInfo}}
					</view>
					<view class="oldname baseinfo">
						 {{movieinfo.originalName}}
					</view>
					<view class="oldname baseinfo">
						 {{movieinfo.totalTime}}
					</view>
					<view class="longtime baseinfo">
						{{movieinfo.releaseDate}}
					</view>
					<view class="descrank">
						<view class="stars">
							<view class="">
								当前评分为 : 
							</view>			
							<view class="">
								<block v-if="movieinfo.score>=0">
									<rankstar :innerscore="movieinfo.score"></rankstar>
								</block>
							</view>
						</view>
						<view class="prisenum">
							<view class="scorenum">
								{{movieinfo.score}}
							</view>
							<view class="numpeoson">
								{{movieinfo.prisedCounts}} 人点了赞
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="line">
				
			</view>
			<view class="desc-movieinfo">
				<view class="title-name">
					简介
				</view>
				<view class="contain-info">
					{{movieinfo.plotDesc}}
				</view>
			</view>
			<view class="movieimgs">
				<view class="titlemoviesimg">
					剧组照
				</view>
				<scroll-view scroll-x="true" class="imgs-scroll">
					<image :src="item" mode="" class="imgs-item" v-for="(item,index) in movieimgs" @click="checkimg(index)"></image>
				</scroll-view>
			</view>
	</view>
</template>

<script>
	import common from '../../../common/common.js'
	import rankstar from '../../../components/rankstar.vue'
	export default {
		data() {
			return {
				
				movieid:"",
				movieinfo:{},
				movieimgs:[]
			}
		},
		onNavigationBarButtonTap(e) {
			if(e.index == 0){
				uni.share({
				    provider: "weixin",
				    scene: "WXSceneSession",
				    type: 0,
					href:"",
					imageUrl:this.movieinfo.cover,
				    summary: "我正在使用HBuilderX开发uni-app，赶紧跟我一起来体验！",
				    success: function (res) {
				        console.log("success:" + JSON.stringify(res));
				    },
				    fail: function (err) {
				        console.log("fail:" + JSON.stringify(err));
				    }
				});
			}
		},
		methods: {
				
			getmovieitem(id){
				uni.request({
					url:common.serverUrl+'/search/trailer/'+id,
					method:"POST",
						
					success:(res)=>{
						console.log(res.data)
						this.movieinfo = res.data.data[0]
						this.movieimgs = res.data.data[0].plotPics
					}
				})
			},
				
			checkimg(index){
				uni.previewImage({
					current:index,
					urls:this.movieimgs,
					indicator: "number"
				})
			},
				
			getbigger(){
				uni.navigateTo({
					url:'../../cover/cover?cover='+this.movieinfo.cover
				})
			}
		},
			
		components:{
			rankstar
		},
		onLoad(e) {
			console.log(e)
			this.movieid =e.id
			this.getmovieitem(e.id)
			uni.setNavigationBarColor({
				frontColor:"#FFFFFF",
				backgroundColor:"#000000"
			})
		},
		onShareAppMessage(res) {
				
			return{
				title:this.movieinfo.name,
				path:'/pages/movie/movie/movie?id='+this.movieid	
			}
		}
	}
</script>

<style>
@import url("./index.css");
</style>
